﻿using Microsoft.AspNetCore.DataProtection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestDataProtection
{
    internal class MyClass
    {
        IDataProtector _dataProtector;
        public MyClass(IDataProtectionProvider dataProtectionProvider)
        {
            _dataProtector = dataProtectionProvider.CreateProtector("MyClass.v1");
        }

        public void RunSample()
        {
            var data = "Hello World";
            var protectedData = _dataProtector.Protect(data);
            Console.WriteLine($"Protected Data: {protectedData}");
            var unprotectedData = _dataProtector.Unprotect(protectedData);
            Console.WriteLine($"Unprotected Data: {unprotectedData}");
        }
    }
}
